package com.ft.oa.web.dev;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ft.oa.domain.dev.DevTask;
import com.ft.oa.domain.dev.Milestone;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.service.dev.MilestoneService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 研发里程碑
 */
@RestController
@RequestMapping("/milestone")
public class MilestoneController {

    @Resource
    private MilestoneService milestoneService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public ApiResult add(@RequestBody Milestone milestone){
        ApiResult result = milestoneService.add(milestone);
        return result;
    }

    /**
     * 修改
     * @return
     */
    @PostMapping("/edit")
    public ApiResult edit(@RequestBody Milestone milestone){
        ApiResult result = milestoneService.edit(milestone);
        return result;
    }

    /**
     * 分页
     */
    @PostMapping ("/page")
    public ApiResult page(@RequestBody Milestone milestone){
        Page<Milestone> page = milestoneService.page(milestone);
        return ApiResult.successWithData(page);
    }

    /**
     * 删除
     * @param milestone
     * @return
     */
    @PostMapping("/del")
    public ApiResult del(@RequestBody Milestone milestone){
        ApiResult result = milestoneService.del(milestone);
        return result;
    }




}
